package com.ohc.leetcode.字符串;

/**
 * 2022年4月20日14:32:52
 */
public class 反转字符串344 {

    public static void reverseString(char[] s) {
        int pre = 0;
        int tail = s.length - 1;
        char temp;
        while (pre < tail) {
            temp = s[pre];
            s[pre] = s[tail];
            s[tail] = temp;
            pre++;
            tail--;
        }
        for (int i = 0; i < s.length; i++) {
            System.out.println("s[i] = " + s[i]);
        }
    }

    public static void main(String[] args) {
        char[] c = new char[]{'h', 'e', 'l', 'l', 'o'};
        reverseString(c);
    }
}
